package com.pengxun.manager.enums;

public enum CodeStatusEnum {
    ENABLE(0, "可用"),
    USED(1, "已用"),
    DIABLE(2, "废弃"),
    CANCEL(3, "已核销");

    private Integer type;
    private String desc;

    private CodeStatusEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static CodeStatusEnum getEnumByType(Integer type){
        CodeStatusEnum[] enums = CodeStatusEnum.values();
        for (CodeStatusEnum codeStatusEnum:enums){
            if(codeStatusEnum.getType() == type){
                return  codeStatusEnum;
            }
        }
        return  null;
    }

    public Integer getType() {
        return this.type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return this.desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
